import myRequest from "./config/request";

const URL = "/role";

export function getRoleMenuByRoleIdApi(roleId) {
  return myRequest.post({
    url: URL + "/getRoleMenuByRoleId",
    data: {
      roleId,
    },
  });
}

export function getRoleListApi(currentPage, pageSize) {
  return myRequest.post({
    url: URL + "/getRoleList",
    data: { currentPage, pageSize },
  });
}

export function createRoleApi(data) {
  return myRequest.post({
    url: URL + "/createRole",
    data,
  });
}

export function updateRoleApi(roleId, roleData) {
  return myRequest.post({
    url: URL + "/updateRole",
    data: {
      roleId,
      roleData,
    },
  });
}

export function deleteRoleApi(id) {
  return myRequest.post({
    url: URL + "/deleteRole",
    data: {
      id,
    },
  });
}

export function getAllRoleApi() {
  return myRequest.get({
    url: URL + "/getAllRole",
  });
}
